package com.hq.ims.data.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.hq.ims.data.annotation.CompareField;
import com.hq.ims.data.entityenum.EnumAuditStatus;
import com.hq.ims.data.entityenum.EnumCompanyLevel;
import com.hq.ims.data.entityenum.EnumCompanyStatus;
import com.hq.ims.data.vo.CompanyMapstruct;
import com.hq.mybatis.base.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author 蒋柏平
 * @since 20240927
 */
@Data
@Alias("Company")
@TableName(value = "company")
@ApiModel(value = "公司表", description = "公司表")
public class Company extends BaseModel<Company> implements Serializable {

    @ApiModelProperty(value = "主键")
    @TableId(value = "company_id", type = IdType.ASSIGN_UUID)
    private String companyId;

    @ApiModelProperty(value = "创建时间 - 不需程序员处理")
    @TableField(value = "create_date_time", fill = FieldFill.INSERT)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDateTime;

    @ApiModelProperty(value = "更新时间 - 不需程序员处理")
    @TableField(value = "update_date_time", fill = FieldFill.INSERT_UPDATE)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDateTime;

    @ApiModelProperty(value = "创建用户id")
    @TableField(value = "create_user_id")
    private String createUserId;

    @ApiModelProperty(value = "创建用户名称")
    @TableField(value = "create_user_name", fill = FieldFill.INSERT)
    private String createUserName;

    @ApiModelProperty(value = "更新用户名")
    @TableField(value = "update_user_name", fill = FieldFill.INSERT_UPDATE)
    private String updateUserName;

    @ApiModelProperty(value = "乐观锁 - 不需程序员处理")
    @TableField(value = "version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "公司编号")
    @TableField(value = "company_code")
    private String companyCode;

    @ApiModelProperty(value = "公司名称")
    @CompareField("公司名称")
    @TableField(value = "company_name")
    private String companyName;

    @ApiModelProperty(value = "企业联系人")
    @TableField(value = "contact_person")
    private String contactPerson;

    @ApiModelProperty(value = "联系人电话")
    @TableField(value = "contact_mobile")
    private String contactMobile;

    @ApiModelProperty(value = "省")
    @TableField(value = "province")
    private String province;

    @ApiModelProperty(value = "市")
    @TableField(value = "city")
    private String city;

    @ApiModelProperty(value = "区/县")
    @TableField(value = "district")
    private String district;

    @ApiModelProperty(value = "街道")
    @TableField(value = "street")
    private String street;

    @ApiModelProperty(value = "企业状态")
    @TableField(value = "status")
    private EnumCompanyStatus status;

    @ApiModelProperty(value = "企业审核状态")
    @TableField(value = "audit_status")
    private EnumAuditStatus auditStatus;

    @ApiModelProperty(value = "企业logo访问地址")
    @TableField(value = "logo_url")
    private String logoUrl;

    @ApiModelProperty(value = "营业执照urls")
    @TableField(value = "business_license_images")
    private String businessLicenseImages;

    @ApiModelProperty(value = "父id(如果是本身则为0)")
    @TableField(value = "parent_id")
    private String parentId;

    @ApiModelProperty(value = "父公司名称")
    @TableField(value = "parent_name")
    @CompareField("父公司")
    private String parentName;

    @ApiModelProperty(value = "根id")
    @TableField(value = "root_id")
    private String rootId;

    @ApiModelProperty(value = "企业等级")
    @TableField(value = "company_level")
    private EnumCompanyLevel companyLevel;

    @ApiModelProperty(value = "是否删除")
    @TableField(value = "is_del")
    @TableLogic
    private Boolean isDel;

    @ApiModelProperty(value = "英文简称")
    @TableField(value = "company_en_simple_name")
    private String companyEnSimpleName;

    @ApiModelProperty(value = "中文简称")
    @TableField(value = "company_cn_simple_name")
    private String companyCnSimpleName;

    @ApiModelProperty(value = "企业收益规则")
    @TableField(value = "company_divide_Into_rule_value")
    @CompareField("企业收益规则")
    private BigDecimal companyDivideIntoRuleValue;

    @ApiModelProperty(value = "证件号码")
    @CompareField("证件号码")
    @TableField(value = "company_card_number")
    private String companyCardNumber;

    @ApiModelProperty(value = "证件类型名称")
    @CompareField("证件类型名称")
    @TableField(value = "company_card_type_name")
    private String companyCardTypeName;

    @ApiModelProperty(value = "证件类型ID")
    @TableField(value = "company_card_type_id")
    private String companyCardTypeId;

    @ApiModelProperty(value = "公司地址")
    @CompareField("公司地址")
    @TableField(value = "company_address")
    private String companyAddress;

    @ApiModelProperty(value = "业务范围")
    @CompareField("业务范围")
    @TableField(value = "business_range")
    private String businessRange;


    public CompanyMapstruct.CompanyRowAuthVo auth() {
        CompanyMapstruct.CompanyRowAuthVo auth = new CompanyMapstruct.CompanyRowAuthVo(this);
        return auth;
    }


}
